home *** CD-ROM | disk | FTP | other *** search
- { the algorithm is not a complete one and is purpose is to show the possibilities of the gTag variable usage
- property Track1: string read FGetTrack1;
- property Artist1: string read FGetArtist1;
- property Title1: string read FGetTitle1;
- property Album1: string read FGetAlbum1;
- property Genre1: string read FGetGenre1;
- property Year1: string read FGetYear1;
- property Comment1: string read FGetComment1;
- property Track2: string read FGetTrack2;
- property Artist2: string read FGetArtist2;
- property Title2: string read FGetTitle2;
- property Album2: string read FGetAlbum2;
- property Genre2: string read FGetGenre2;
- property Year2: string read FGetYear2;
- property Comment2: string read FGetComment2;
-
- //Tag fields
- property Track: string read FTrack write FTrack;
- property TrackF: string read FFormatTrack;
- property Artist: string read FArtist write FArtist;
- property Title: string read FTitle write FTitle;
- property Album: string read FAlbum write FAlbum;
- property Genre: string read FGenre write FGenre;
- property Year: string read FYear write FYear;
- property Comment: string read FComment write FComment;
- property Language: string read FLanguage write FLanguage;
- property Composer: string read FComposer write FComposer;
- property Copyright: string read FCopyright write FCopyright;
- property URL: string read FURL write FURL;
- property EncodedBy: string read FEncodedBy write FEncodedBy;
- property Lyrics: string read FLyrics write FLyrics;
- property Tones: string read FTones write FTones;
- property Styles: string read FStyles write FStyles;
- property Mood: string read FMood write FMood;
- property Situation: string read FSituation write FSituation;
- property Rating: string read FRating write FRating;
- property Quality: string read FQuality write FQuality;
- property Tempo: string read FTempo write FTempo;
- property Type_: string read FType write FType;
- //
-
- // audio info
- property Bitrate: string read FBitrate;
- property Mode: string read FMode;
- property SampleRate: string read FSampleRate;
- property EncoderUsed: string read FEncoderUsed;
- property Version: string read FVersion;
- property VBR: boolean read FVBR;
- // Other
- property PicCount: integer read FPicCount;
- property HasPictures: boolean read FHasPictures;
- property HasLyrics: boolean read FHasLyrics;
- property TagExists: boolean read FTagExists;
-
- property FileType: integer read FFileType;
- property TagType: integer read FTagType;
- property FileSize: integer read FFileSize;
- property AudioSize: integer read FAudioSize;
- property Duration: integer read FDuration;
- property DurationF: string read FFormatDuration;
-
- property Caption: string read FCaption;
- property CaptionTag1: string read FCaptionTag1;
- property CaptionTag2: string read FCaptionTag2;
- property ResultStr : string read FResultStr;
- }
-
- // this program will not use the values from the grid
- // it will rather reload the actual tags from each file ( slower )
- Program ID3_sync;
-
- const
- _BAD_TITLE = 'TRACK*';
- _BAD_ARTIST = 'UNKNOWN*';
-
- var
- sTmp1, sTmp2: string;
- bUpdated: boolean;
-
- // we will use the advanced delphi MatchesMask function for this
- procedure Fix_field( const sField,sValue: string );
- begin
- if MatchesMask( tg_getField( sField ), sValue ) then begin //probaply bogus field in the grid
- bUpdated := true;
- if MatchesMask( sTmp1, sValue ) then begin // was ID3v1 responsible ?
-
- if MatchesMask( sTmp2, sValue ) then begin // was ID3v2 same crap ?
- tg_setField( sField, '' ) // better have nothing
- end else begin
- tg_setField( sField, sTmp2 ) // force id3v2 title field
- end;
-
- end else if MatchesMask( sTmp2, sValue ) then begin // was ID3v2 responsible ?
-
- if MatchesMask( sTmp1, sValue ) then begin // was ID3v1 same crap ?
- tg_setField( sField, '' ) // better have nothing
- end else begin
- tg_setField( sField, sTmp1 ) // force id3v1 title field
- end;
-
- end;
-
- end;
-
- end;
-
-
- begin
-
- tg_Init;
-
- repeat
-
- tg_LoadFile; // re load info from file so we can use the gTag class variable
- if gTag.TagType <> 1 then continue; // not and ID3 tag file
- bUpdated := false;
- // do something for the title field
- sTmp1 := gTag.Title1; // id3v1 field
- sTmp2 := gTag.Title2; // id3v2 field
- Fix_field( 'Title', _BAD_TITLE );
-
- // do something for the artist field
- sTmp1 := gTag.Artist1; // id3v1 field
- sTmp2 := gTag.Artist2; // id3v2 field
- Fix_field( 'Artist', _BAD_ARTIST );
-
- if bUpdated then tg_setresult( '!' );
-
- until not tg_Skip;
-
- end.
-